<!-- addEditGroup.html 2017-08-11 11:33:14-->
#@HplusLayout()
#define css()
  <link href="#(res_path)/hplus/css/plugins/select2/select2.min.css" rel="stylesheet">
#end
#define content()
<div style="padding:10px;height: 100%">
	<form method="post" class="form-horizontal required-validate" action="saveGroup" novalidate="novalidate" onsubmit="return validateCallback(this,listDialogAjaxDone)">
		<input type="hidden" name="authGroup.id" value="#(authGroup.id)"/>
		
				<div class="form-group">
				<label class="col-xs-3 control-label">会员平台：</label>
				<div class="col-xs-8">
				#if(authGroup.id)
					<div style="padding-top:7px">#(data("AUTH_PORTAL",authGroup.portal))</div>
				#else
	<select name="authGroup.portal" class="form-control required">
		
		#(data("AUTH_PORTAL","option",authGroup.portal))
	</select>
	<span class="help-block m-b-none"><i class="glyphicon glyphicon-info-sign"></i>保存后无法修改</span>
		#end
				</div>
		</div>
		<div class="form-group">
				<label class="col-xs-3 control-label">名称：</label>
				<div class="col-xs-8">
	<input type="text" class="form-control required" name="authGroup.name" value="#(authGroup.name)"/>
				</div>
		</div>
		<div class="form-group">
				<label class="col-xs-3 control-label">备注：</label>
				<div class="col-xs-8">
	<textarea name="authGroup.remark" class="form-control  ">#(authGroup.remark)</textarea>
				</div>
		</div>		
		<div class="form-group">
			<label class="col-xs-3 control-label">会员列表：</label>
			<div class="col-xs-8">
				<select name="users" class="form-control" style="width:100%" multiple="multiple">
					#for(item:userList)
						<option value="#(item.user_id)" selected="selected">#(item.user_id_name)</option>
					#end
				</select>
			</div>
		</div>
		<div class="form-group">
				<label class="col-xs-3 control-label">状态：</label>
				<div class="col-xs-8">
					#for(item:data("ENABLE_FLAG"))
					<label style="font-weight:normal;line-height: 37px;margin-bottom: 0px;padding-right: 5px"><input class="required" type="radio" name="authGroup.enable_flag" #if(authGroup.enable_flag)#if(authGroup.enable_flag==item.key)checked="checked"#end#elseif(item.key=="T")checked="checked"#end value="#(item.key)"/> #(item.value.name) </label>
					#end
				</div>
		</div>
		<div class="form-group">
			<div class="col-xs-8 col-xs-offset-3">
				<button type="submit" class="btn btn-primary">保存</button>
			</div>
		</div>
	</form>
</div>
#end
#define js()
<script src="#(res_path)/hplus/js/plugins/validate/jquery.validate.min.js"></script>
<script src="#(res_path)/hplus/js/plugins/validate/messages_zh.min.js"></script>
<script src="#(res_path)/hplus/js/plugins/laydate/laydate.js"></script>
<script src="#(res_path)/hplus/js/plugins/select2/select2.full.min.js"></script>
#end
#define jsFunction()
<script>
$(function(){
	$("select[name='users']").select2({
		placeholder:"请输入用户名或姓名搜索",
		ajax: {
			url: "select2LoadUserList",
		  dataType: 'json',
		  delay: 250,
		  data: function (params) {
			  var portal ="#(authGroup.portal)";
			  if($("select[name='authGroup.portal']").length>0){
				  portal = $("select[name='authGroup.portal']").val();
			  }
		  	return {
		  		keyword: params.term,
		    	portal: portal,
		    };
		  },
		  processResults: function (data) {
		  	return {
		    	results: data
		    };
		 	},
		  cache: true
		}
	});
});
</script>
#end